<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Response;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function response($caller, $requestId, $code = 200, $msg = 'success', $data = [])
    {
        $this->logger->info($caller . ' response', ['requestId' => $requestId, 'code' => $code, 'msg' => $msg, 'data' => $data]);
        return Response::json(['code' => $code, 'msg' => $msg, 'requestId' => $requestId, 'data' => $data]);
    }
}
